package com.zjm.behavioral.state;

/**
 * 发放奖品的状态
 */
public class DispenseState extends State {

    RaffleActivity raffleActivity;

    public DispenseState(RaffleActivity raffleActivity) {
        this.raffleActivity = raffleActivity;
    }

    @Override
    public void deductMoney() {
        System.out.println("不能扣除积分");
    }

    @Override
    public boolean raffle() {
        System.out.println("不能抽奖");
        return false;
    }

    @Override
    public void dispensePrize() {
        if(raffleActivity.getCount() > 0){
            System.out.println("恭喜您，中奖了");
            raffleActivity.setState(raffleActivity.getNoRaffleState());
        }else{
            System.out.println("奖品已经发放完了");
            raffleActivity.setState(raffleActivity.getDispenseOutState());
        }

    }
}
